package com.stars.distributed.schedule.client.demo.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.rocketmq.client.producer.SendResult;
import com.stars.distributed.schedule.client.demo.rocketmq.MQDistributedCallBackProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class TestController {

    @Autowired
    private MQDistributedCallBackProducer producer;

    @RequestMapping("send")
    public String sendMessage(){

        SendResult result = producer.sendTest("com-callback-topic-demo123","helloTest");
        return JSON.toJSONString(result);
    }
}